<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class client extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('xmlrpc');
        $server_url = site_url('service');
        $this->xmlrpc->server($server_url, 80);
    }

    function index() {
        $this->xmlrpc->method('getjenis');
        $request = array('Latihan');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

    function siswa() {
        $this->xmlrpc->method('getsiswa');
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

    function soal() {
        $this->xmlrpc->method('getsoal');
        $request = array('5');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

    function jawaban() {
        $this->xmlrpc->method('getjawaban');
        $request = array('1');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

    function login() {
        $this->xmlrpc->method('login');
        $request = array('10.11.3544', 'tes');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function tes_login() {
        $this->load->model('m_siswa');
        $fak = $this->m_siswa->login_siswa('10.11.3544', 'tes');
        echo '<pre>';
        print_r($fak);
        echo '</pre>';
    }

    function image() {
        $this->xmlrpc->method('getimageall');
        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }

}

?>
